package com.joysuch.wwyt.workflow.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;


@Data
@Entity
@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Table(name = "WWYT_WORKFLOW_TASK_HISTORY")
@SQLDelete(sql = "update WWYT_WORKFLOW_TASK_HISTORY set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update WWYT_WORKFLOW_TASK_HISTORY set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class WorkFlowTaskHistory implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("主键ID")
    private Long id;

    @ApiModelProperty("节点名称")
    private String taskName;

    @ApiModelProperty("父级引用ID")
    private Long parentId;

    @ApiModelProperty("表单数据Json")
    private String formData;

    @org.springframework.data.annotation.CreatedBy
    @ApiModelProperty("创建人")
    private Long createBy;

    @org.springframework.data.annotation.CreatedDate
    @ApiModelProperty("创建时间 --app执行时间")
    private Date createTime;

    @ApiModelProperty("版本")
    private Integer version;


    @ApiModelProperty("租户")
    private Long tenentId;

    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @ApiModelProperty("删除标记")
    private String deleteFlag;

    @ApiModelProperty("执行人员")
    @Transient
    private String userName;

    @ApiModelProperty("执行动作")
    @Transient
    private String action;

}
